/**
 * 定义站点信息管理模块
 */
(function(window, angular, undefined){
	var Module = angular.module('water.apps.sw.systemConfig.remoteControlOrder.remoteControlOrderManager', ['water.entity.domain']);
	
	Module.controller('remoteControlOrderManagerController',function($rootScope,$scope,$domainService){

		/**
		 * 新建model
		 */
		$scope.createModel;
		/**
		 * 编辑model
		 */
		$scope.editModel;
		/**
		 * 分析仪列表数据
		 */
		$scope.dataList;
		/**
		 * 编辑对话框对象
		 */
		$scope.editDialog;
		/**
		 * 新增对话框
		 */
		$scope.createDialog;
		
		/**
		 * 新增按钮点击事件
		 */
		$scope.onCreateClick = function(){
			$scope.createModel = {};
			$scope.createDialog.open();
		}
		/**
		 * 提交事件
		 */
		$scope.onSubmitCreateClick = function(model){
			$domainService.createDomainItem("REMOTE_CONTROL_ORDER",model).then(function(){
				$scope.createDialog.close();
				_getList();
				$.messager.alert("保存成功","保存成功",'info');
			});
		}
		/**
		 * 提交修改事件
		 */
		$scope.onSubmitEditClick = function(model){
			$domainService.updateDomainItem("REMOTE_CONTROL_ORDER",model).then(function(){
				$scope.editDialog.close();
				_getList();
				$.messager.alert("保存成功","保存成功",'info');
			});
		}
		/**
		 * 编辑按钮点击事件
		 */
		$scope.onEditClick = function(model){
			$scope.editModel = model;
			$scope.editDialog.open();
		}
		/**
		 * 刷新列表
		 */
		$scope.onRefreshClick = function(){
			_getList();
		}
		
		/**
		 * 获取列表
		 */
		function _getList(){
			$domainService.getList("REMOTE_CONTROL_ORDER").then(function(data){
				$scope.dataList = data;
			});
		};
		
		_getList();
	});
}(window, angular));	